#@embedLayout()


#define content()

<form id="formId" method="post">
    <table class="table table-bordered">
        <tr>
            <td style="padding-top:15px;">#(_res.get('policy.form.authtype')):</td>
            <td>
                <select name="policy.auth_type" id="authType" class="easyui-combobox" style="width:200px;"
                        data-options="editable:false">
                    #for(dict : authTypeList)
                    <option value="#(dict.dict_text)">#(dict.dict_name)</option>
                    #end
                </select>
            </td>
        </tr>
        <tr>
            <td style="padding-top:15px;">#(_res.get('policy.form.transtype')):</td>
            <td>
                <select name="policy.trans_type" id="transType" class="easyui-combobox" style="width:200px;"
                        data-options="editable:false">
                    #for(dict : transTypeList)
                    <option value="#(dict.dict_text)">#(dict.dict_name)</option>
                    #end
                </select>
            </td>
        </tr>
    </table>
</form>

#end


#define css()


#end


#define js()

<script type="text/javascript">
    function datagrid_save(opr_type) {
        var url = '';
        if (opr_type == 'add') {
            url = contextRootPath + '/policy/save';
        }

        $('#formId').form('submit', {
                url: url,
                onSubmit: function () {
                    var flag = $(this).form('enableValidation').form('validate');
                    if (flag) {
                        showProcess(true, '温馨提示', '正在提交数据...');
                    }
                    return flag;
                },
                success: function (data) {
                    showProcess(false);

                    data = eval('(' + data + ')');

                    if (data.flag) {
                        var res = data.data;
                        $("#policyName").combobox("reload").combobox("select", res.pl_id);

                        $("#" + authMetadataDatagrid).datagrid("reload", {
                            'policy.pl_id': res.pl_id
                        });
                        $("#" + acceptPolicyDatagrid).datagrid("reload", {
                            'policy.pl_id': res.pl_id
                        });

                        $('#crud_dlg').dialog('close');

                    } else {
                        $.messager.alert("提示", data.message);
                    }
                    $.messager.alert("提示", data.message);
                },

                onLoadError: function () {
                        showProcess(false);
                        $.messager.alert('温馨提示', '由于网络或服务器太忙，提交失败，请重试！');
                    }
            }
        )
        ;
    }

</script>

#end


